from pydantic import BaseModel
from typing import List, Optional, Any, Dict
from fastapi.responses import StreamingResponse

class CozeRequest(BaseModel):
    content: str
class CozeMessage(BaseModel):
    role: str = "user"
    content: str
    content_type: str = "text"

class CozeApiRequest(BaseModel):
    bot_id: str
    user_id: str
    stream: bool
    auto_save_history: bool
    conversation_id: Optional[str] = None
    additional_messages: List[CozeMessage]

class CozeResponse(BaseModel):
    status: str
    message: str
    data: Optional[Dict[str, Any]] = None

class CozeStreamResponse(StreamingResponse):
    def __init__(self, content: Any):
        super().__init__(
            content=content,
            media_type="text/event-stream"
        )
